/*   1:    */ package com.atomikos.icatch.imp;
/*   2:    */ 
/*   3:    */ import com.atomikos.icatch.CompositeTerminator;
/*   4:    */ import com.atomikos.icatch.Extent;
/*   5:    */ import com.atomikos.icatch.HeurHazardException;
/*   6:    */ import com.atomikos.icatch.HeurMixedException;
/*   7:    */ import com.atomikos.icatch.HeurRollbackException;
/*   8:    */ import com.atomikos.icatch.RollbackException;
/*   9:    */ import com.atomikos.icatch.SysException;
/*  10:    */ import com.atomikos.icatch.TransactionControl;
/*  11:    */ import com.atomikos.icatch.TransactionService;
/*  12:    */ import java.util.Dictionary;
/*  13:    */ import java.util.Stack;
/*  14:    */ 
/*  15:    */ class CompositeTerminatorImp
/*  16:    */   implements CompositeTerminator
/*  17:    */ {
/*  18: 48 */   protected CoordinatorImp coordinator_ = null;
/*  19: 50 */   protected CompositeTransactionImp transaction_ = null;
/*  20: 52 */   protected TransactionService ts_ = null;
/*  21:    */   
/*  22:    */   CompositeTerminatorImp(TransactionService ts, CompositeTransactionImp transaction, CoordinatorImp coordinator)
/*  23:    */   {
/*  24: 61 */     this.ts_ = ts;
/*  25: 62 */     this.coordinator_ = coordinator;
/*  26: 63 */     this.transaction_ = transaction;
/*  27:    */   }
/*  28:    */   
/*  29:    */   public void commit()
/*  30:    */     throws HeurRollbackException, HeurMixedException, HeurHazardException, SysException, SecurityException, RollbackException
/*  31:    */   {
/*  32: 76 */     Stack errors = new Stack();
/*  33: 77 */     TransactionControl control = this.transaction_.getTransactionControl();
/*  34:    */     
/*  35: 79 */     this.transaction_.doCommit();
/*  36:    */     
/*  37:    */ 
/*  38:    */ 
/*  39:    */ 
/*  40: 84 */     Dictionary cascadelist = control.getExtent().getRemoteParticipants();
/*  41: 85 */     this.coordinator_.setGlobalSiblingCount(this.coordinator_.getLocalSiblingCount());
/*  42:    */     
/*  43: 87 */     this.coordinator_.setCascadeList(cascadelist);
/*  44: 89 */     if (this.transaction_.isRoot()) {
/*  45:    */       try
/*  46:    */       {
/*  47: 92 */         this.coordinator_.terminate(true);
/*  48:    */       }
/*  49:    */       catch (RollbackException rb)
/*  50:    */       {
/*  51: 96 */         throw rb;
/*  52:    */       }
/*  53:    */       catch (HeurHazardException hh)
/*  54:    */       {
/*  55: 98 */         throw hh;
/*  56:    */       }
/*  57:    */       catch (HeurRollbackException hr)
/*  58:    */       {
/*  59:100 */         throw hr;
/*  60:    */       }
/*  61:    */       catch (HeurMixedException hm)
/*  62:    */       {
/*  63:102 */         throw hm;
/*  64:    */       }
/*  65:    */       catch (SysException se)
/*  66:    */       {
/*  67:104 */         throw se;
/*  68:    */       }
/*  69:    */       catch (Exception e)
/*  70:    */       {
/*  71:106 */         errors.push(e);
/*  72:107 */         throw new SysException("Unexpected error: " + e.getMessage(), errors);
/*  73:    */       }
/*  74:    */     }
/*  75:    */   }
/*  76:    */   
/*  77:    */   public void rollback()
/*  78:    */     throws IllegalStateException, SysException
/*  79:    */   {
/*  80:122 */     Stack errors = new Stack();
/*  81:    */     
/*  82:124 */     this.transaction_.doRollback();
/*  83:126 */     if (this.transaction_.isRoot()) {
/*  84:    */       try
/*  85:    */       {
/*  86:128 */         this.coordinator_.terminate(false);
/*  87:    */       }
/*  88:    */       catch (Exception e)
/*  89:    */       {
/*  90:130 */         errors.push(e);
/*  91:131 */         throw new SysException("Unexpected error in rollback: " + e.getMessage(), errors);
/*  92:    */       }
/*  93:    */     }
/*  94:    */   }
/*  95:    */ }


/* Location:           C:\myfile\mysoft\apache-maven-3.5.0-bin\apache-maven-3.5.0\myrep\com\atomikos\transactions\3.7.0\transactions-3.7.0.jar
 * Qualified Name:     com.atomikos.icatch.imp.CompositeTerminatorImp
 * JD-Core Version:    0.7.0.1
 */